<?php
/***************************************************************************
 * 
 * Copyright (c) 2010 , Inc. All Rights Reserved
 * $Id$:ActionController.php,2010/05/10 11:41:44 
 * 
 **************************************************************************/
 
 
 
/**
 * @file ActionController.php
 * @author huqingping
 * @date 2010/05/10 11:41:44
 * @version 1.0 
 * @brief 
 *  
 **/
require_once PAGE_ROOT.'common/YouaActionController.php';

final class ActionController extends YouaActionController
{
	function index($id)
	{
		//var_dump("item_id",$id);
		//var_dump($_SERVER);
		//echo json_encode(array('a'=>'b'));
		$this->checkInput(array('check'=>'test'));
		$this->response->setView('item/index');
	}
	function test()
	{
		//$this->response->setHeader('Content-Type: text/plain');
		$this->response->setCookie('name','value');
		echo $this->response->buildView('item/test',array('test'=>'aaa'));
	}

	function errhandle()
	{
		$err = $this->request->get('err');
		throw new Exception($err);
	}

	function json()
	{
		list($k1,$k2,$k3) = $this->request->get(array('k1','k2','k3'));
		$this->response->set('k1',$k1);
		$this->response->set('k2',$k2);
		$this->response->set('k3',$k3);
		$this->response->set('key','啊啊');
	}

	function raw()
	{
		$this->response->setRaw(file_get_contents(dirname(__FILE__).'/ActionController.php'));
	}

	function demo()
	{
		require_once 'apiproxy/ApiProxy.php';
		$item = ApiProxy::getProxy('item');
		$item->demo();
		$demo = ApiProxy::getProxy('demo');
		$demo->demo();

		$this->response->set('test',$this->request->get('key'));
		$this->response->setView('item/detail',array('test1'=>'hello framework'));
	}

	function callback()
	{
		$this->response->set('arg','value');
		$this->response->setCallback('my_function');
	}

	function error()
	{
		$this->response->set('test','aaa');
		throw new Exception('err');
	}
	function redirect()
	{
		$this->response->redirect('/item/callback');
	}
}






/* vim: set ts=4 sw=4 sts=4 tw=100 noet: */
?>
